package com.estranger.www.listener;

import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;

import com.estranger.www.bean.AccountCreateEvent;
import com.estranger.www.bean.BaseEvent;
import com.estranger.www.bean.function.OriginalEvent;
import com.estranger.www.enumeration.EventEnum;

/**
 * @Created by michangtao
 * @Date 2021/11/4 10:44
 * @Description TODO
 */
@Component
public class CustomEventListener {

    @EventListener
    public void handle(BaseEvent event){
        EventEnum.matchType(event.getEventType()).handle(event);
    }

    @EventListener
    public void deal(OriginalEvent event){
        event.getProcessor().deal(event.getData());
    }

}
